package org.springblade.modules.repair.vo.rescue;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.modules.repair.enums.MaintainPlanContentEnum;
import org.springblade.modules.repair.enums.RescueArriveEnum;
import org.springblade.modules.repair.enums.TaskStatusEnum;

import java.util.Date;

/**
 * @Author ysq
 * @Date 2025/07/08
 * @Description 调度分页VO
 */
@Data
public class DispatcherPageRespVO {

	@ApiModelProperty(value = "工单id")
	private Long planId;

	@ApiModelProperty(value = "电梯id")
	private Long elevatorId;

	@ApiModelProperty(value = "项目id")
	private Long buildingId;

	@ApiModelProperty(value = "状态")
	private Integer status;

	@ApiModelProperty(value = "状态描述")
	private String statusName;

	@ApiModelProperty(value = "创建时间")
	private Date createTime;

	@ApiModelProperty(value = "调度时间")
	private Date allocateTime;

	@ApiModelProperty(value = "已到达时间")
	private Date arriveTime;

	@ApiModelProperty(value = "项目名称")
	private String buildingName;

	@ApiModelProperty(value = "项目地址")
	private String buildingAddress;

	@ApiModelProperty(value = "项目别名")
	private String buildingAlias;

	@ApiModelProperty(value = "纬度")
	private String latitude;

	@ApiModelProperty(value = "经度")
	private String longitude;

	@ApiModelProperty(value = "电梯详细位置")
	private String elevatorAddress;

	@ApiModelProperty(value = "电梯别名")
	private String elevatorAlias;

	@ApiModelProperty(value = "报警人")
	private String alarmName;

	@ApiModelProperty(value = "报警人电话")
	private String phone;

	@ApiModelProperty(value = "报警来源")
	private String trapFrom;

	@ApiModelProperty(value = "报警来源值")
	private String trapFromValue;

	@ApiModelProperty(value = "到达时间最大阔值")
	private Date maximumArrivalTime;

	@ApiModelProperty(value = "救援要求时间类型 0-默认（30min），1-项目")
	private Integer maximumType;

	@ApiModelProperty(value = "到达预警状态")
	private Integer arrivalWarning;

	@ApiModelProperty(value = "到达预警状态名称")
	private String arrivalWarningDesc;

	@ApiModelProperty(value = "到达预警状态触发时间")
	private Date arrivalWarningTime;

	@ApiModelProperty(value = "救援人员信息")
	private String userInfos;

	public void setStatus(Integer status) {
		this.status = status;
		if (status != null) {
			this.statusName = TaskStatusEnum.getTaskName(MaintainPlanContentEnum.MAINTAIN_KR.getId(), status);
		}
	}

	public void setArrivalWarning(Integer arrivalWarning) {
		this.arrivalWarning = arrivalWarning;
		if (arrivalWarning != null && arrivalWarning > 0) {
			this.arrivalWarningDesc = RescueArriveEnum.getName(arrivalWarning);
		}
	}
}
